#region Summary

// 
// Owner : JackieHan 
// 
// Solution : Skomart.Spider 
// 
// Project : Jackie.Utility
// 
// File : PropertyNotNullExcetpion.cs
// 
// CopyRight : Copyright © 2010-2011 Skomart Corporation, All Rights Reserved 
// 
// Summary : 某个类的某个字段不能为Null或空的异常
// 
// History : 
//			2010-09-26 10:57:01	    Create 
// 

#endregion

#region Using

using System;
using System.Collections.Generic;

#endregion

namespace Jackie.Utility.CustomException
{
    /// <summary> 
    /// 某个类的某个字段不能为Null或空的异常
    /// </summary>
    public class PropertyNotNullException : ApplicationException
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="className">类名</param>
        /// <param name="propertyName">不能为空或Null的字段</param>
        public PropertyNotNullException(string className, string propertyName)
            : base(GetErrorMessage(className, propertyName))
        {
            this.ClassName = className;
            this.PropertyName = propertyName;
        }

        /// <summary>
        /// 类名
        /// </summary>
        public string ClassName { get; set; }

        /// <summary>
        /// 不能为空或Null的字段
        /// </summary>
        public string PropertyName { get; set; }

        private static string GetErrorMessage(string className, string propertyName)
        {
            return string.Format("property[{0}] of class[{1}] must be not empty or null!", propertyName, className);
        }
    }
}